/**************************************************************

Copyright Astrium Services GEO-Information / Spot Image
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

 ***************************************************************/
package com.spotimage.catalog.client.util;

import java.util.HashMap;
import java.util.Map;

/**
 * Provide scene types
 */
public class SceneTypes {

	/** Singleton instance */
	private static SceneTypes sceneTypes;
	/** Spot scene types */
	private Map<String, String> types;

	private SceneTypes() {
		types = new HashMap<String, String>();

		types.put("V", "2.5 m. color");
		types.put("T", "2.5 m. pan");
		types.put("U", "5 m. color");
		types.put("A", "5 m. pan");
		types.put("B", "5 m. pan");
		types.put("J", "10 m. color");

		// SPOT5 HRS
		types.put("W", "HRS stereo pan");
		types.put("S", "HRS pan");

		// SPOT4
		types.put("R", "10 m. color");
		types.put("M", "10 m. pan");
		types.put("I", "20 m. color");

		// SPOT 1,2,3
		types.put("Q", "10 m. color");
		types.put("P", "10 m. pan");
		types.put("X", "20 m. color");
	}

	/**
	 * Get scene type from scene id.
	 * @param codeType
	 * @return
	 */
	public static String get(String sceneId) {
		if (sceneTypes == null)	sceneTypes = new SceneTypes();
		String codeType = String.valueOf(sceneId.charAt(sceneId.length()-1));
		String type = sceneTypes.types.get(codeType);
		if (type == null) type = "Unknown type";
		return type;
	}
}
